From bb029a0c01cd2a680bea629c7483bc9d2dfaab56 Mon Sep 17 00:00:00 2001 From: robertl Date: Sat, 16 Aug 2008 16:52:18 +0000 Subject: [PATCH] NMEA: Fix obscure mem leak on AMOD waypoints. As a bonus, created points now have speed, fix data in them when there's sufficient prior context in the file. --- nmea.c | 9 +++++++-- reference/track/amod.gpx | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/nmea.c b/nmea.c index e11b89063..4143e9dff 100644 --- a/nmea.c +++ b/nmea.c @@ -549,8 +549,12 @@ gprmc_parse(char *ibuf) * going from 235959 to 000000. */ nmea_set_waypoint_time(curr_waypt, &tm, microseconds); } - if (!amod_waypoint) - return; + /* This point is both a waypoint and a trackpoint. */ + if (amod_waypoint) { + waypt_add(waypt_dupe(curr_waypt)); + amod_waypoint = 0; + } + return; } waypt = waypt_new(); @@ -570,6 +574,7 @@ gprmc_parse(char *ibuf) nmea_release_wpt(curr_waypt); curr_waypt = waypt; + /* This point is both a waypoint and a trackpoint. */ if (amod_waypoint) { waypt_add(waypt_dupe(waypt)); amod_waypoint = 0; diff --git a/reference/track/amod.gpx b/reference/track/amod.gpx index 1ed5e9943..e086bd23d 100644 --- a/reference/track/amod.gpx +++ b/reference/track/amod.gpx @@ -14,10 +14,16 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/ WPT001 + 269.900000 WPT002 WPT002 WPT002 + 3d + 6 + 1.300000 + 1.800000 + 2.200000 -- 2.30.2